#		    	M A K U
#	c o m p i l a t i o n    c o n f i g u r a t i o n

# Run "qmake; make; make install" to compile and install the program on Unix systems.
# Optional arguments can tune install paths (as in "qmake PREFIX=$HOME").

contains( MODE, debug ) {
    CONFIG += debug  warn_on
    TARGET = maku_debug
    message( "Configuring for debug only..." )
 }
else {
    contains( MODE, all ) {
	CONFIG += debug_and_release build_all warn_on
	CONFIG(debug, debug|release) {
	    TARGET = maku_debug
	} else {
	    TARGET = maku
	}
    }
    else {
	CONFIG += release warn_on
	TARGET = maku
    }
}

QT += opengl xml

LIBS += -lQGLViewer -lOpenMeshCore -lOpenMeshTools

isEmpty( PREFIX ) {
  PREFIX=/usr
}

# Need TESTING under Mac and Windows, otherwise: linux-g++ {...}
  system(echo \"$${LITERAL_HASH}ifndef MAKU_CONFIG_H\" > config.h)
  contains( CGAL, yes ) {
    system(echo \"$${LITERAL_HASH}define WITH_CGAL\" >> config.h)
    LIBS += -lCGAL
    HEADERS += boundingspheret.h
    #be sure next line is uncommented if you are using CGAL v.3.4 and commented if you are using CGAL v.3.3
    #QMAKE_CXXFLAGS += -frounding-math
  }
  contains( GLEW, yes ) {
    system( echo \"$${LITERAL_HASH}define WITH_GLEW\" >> config.h )
    LIBS += -lGLEW
    # install shaders
    isEmpty( SHADERS_DIR ) {
      SHADERS_DIR = $${PREFIX}/share/maku
    }
    shaders.path = $${SHADERS_DIR}/shaders
    shaders.files = shaders/*.frag shaders/*.vert
    INSTALLS *= shaders
  }
  system( echo \"$${LITERAL_HASH}endif\" >> config.h )
  HEADERS += config.h
# End TESTING

DESTDIR = .
MOC_DIR = .moc
OBJECTS_DIR = .obj
TEMPLATE = app

FORMS = guis/mainwindow.ui guis/decimaterdialog.ui

HEADERS +=	mainwindow.h \
		viewerdock.h \
		scenet.h \
		scenebase.h \
		viewer.h \
		auxviewer.h \
		simplifiert.h \
		decimaterdialog.h \
		decimateroptions.h \
		boundingbox.h \
		boundingsphere.h \
		boundingboxt.h                

SOURCES +=	mainwindow.cpp \
		viewerdock.cpp \
		main.cpp \
		scenet.cpp \
		scenebase.cpp \
		viewer.cpp \
		auxviewer.cpp \
		decimaterdialog.cpp

RESOURCES = src.qrc

INCLUDEPATH += bounding_geometry
DEPENDPATH  += . bounding_geometry

isEmpty( INSTALL_DIR ) {
  INSTALL_DIR = $${PREFIX}/bin
}

target.path = $${INSTALL_DIR}

INSTALLS *= target
